namespace Commons
{
    using System.Collections.Generic;
    using System.Windows;
    using System.Windows.Media;
    using CustomControls;
    using WPFBPMN;
    using WPFBPMN.Utils;

    public class Utils
    {
        public static List<ShapeType> ArrayBPMNContainers = new List<ShapeType>();

        public static List<ShapeType> ArrayAllLaneShapes = new List<ShapeType>();

        public static Brush BrushCanvasNewShape = Brushes.LightBlue;

        public static Dictionary<ShapeType, List<ShapeType>> BPMNLegalShapes = new Dictionary<ShapeType, List<ShapeType>>();

        static Utils()
        {
            ArrayBPMNContainers.Add(ShapeType.BPMNLane);
            ArrayBPMNContainers.Add(ShapeType.BPMNPool);

            //LegalShapes
            BPMNLegalShapes.Add(ShapeType.BPMNTopLevel, new List<ShapeType>());
            BPMNLegalShapes.Add(ShapeType.BPMNPool, new List<ShapeType>());
            BPMNLegalShapes.Add(ShapeType.BPMNLane, new List<ShapeType>());

            BPMNLegalShapes[ShapeType.BPMNTopLevel].Add(ShapeType.BPMNPool);
            BPMNLegalShapes[ShapeType.BPMNPool].Add(ShapeType.BPMNLane);
            BPMNLegalShapes[ShapeType.BPMNLane].Add(ShapeType.BPMNEventEnd);
            BPMNLegalShapes[ShapeType.BPMNLane].Add(ShapeType.BPMNEventIntermediate);
            BPMNLegalShapes[ShapeType.BPMNLane].Add(ShapeType.BPMNEventStart);
            BPMNLegalShapes[ShapeType.BPMNLane].Add(ShapeType.BPMNGateway);
            BPMNLegalShapes[ShapeType.BPMNLane].Add(ShapeType.BPMNActivity);

        }

        public static void UpdateWindowMainBPMNTV()
        {
            WindowMain wm = Application.Current.Windows[0] as WindowMain;
            if (wm != null)
            {
                wm.UpdateTvWithCanvas();
            }
        }

        public static void PopulateProperties(BPMNShape shape)
        {
            WindowMain wm = Application.Current.Windows[0] as WindowMain;
            if (wm != null)
            {
                wm.addProperties(shape);
            }
        }
    }
}